package com.manager.cms.service.impl;

import com.github.pagehelper.PageHelper;
import com.manager.cms.bo.ExpressDelivery;
import com.manager.cms.common.Pageable;
import com.manager.cms.mapper.ExpressDeliveryMapper;
import com.manager.cms.service.ExpressDeliveryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 * @author 
 * @version v1.0
 * @date 2020-05-19
 */
@Service
public class ExpressDeliveryServiceImpl implements ExpressDeliveryService {

    @Autowired
    private ExpressDeliveryMapper expressDeliveryMapper;

    @Override
    public void insert(ExpressDelivery record) {
        expressDeliveryMapper.insert(record);
    }

    @Override
    public void update(ExpressDelivery record){
        expressDeliveryMapper.update(record);
    }

    @Override
    public void del(String id){
        expressDeliveryMapper.del(id);
    }

    @Override
    public ExpressDelivery selectByPrimaryKey(String id){
        return expressDeliveryMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<ExpressDelivery> getList(ExpressDelivery record){
        return expressDeliveryMapper.selectByRecord(record);
    }

    @Override
    public Pageable<ExpressDelivery> pageList(ExpressDelivery record, Integer pageNum, Integer pageSize){
        Integer count = expressDeliveryMapper.countByRecord(record);
        PageHelper.startPage(pageNum, pageSize);
        List<ExpressDelivery> list = expressDeliveryMapper.selectByRecord(record);
        return new Pageable<>(list, count, pageSize, pageNum);
    }

}